﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Transcend.DP3.Helper
{
	public class CollectionHelper
	{

		/// <summary>
		/// 合并dictionary
		/// </summary>
		public static void Merge(Dictionary<string, object> main, bool overrideExists, params Dictionary<string, object>[] dicn)
		{
			if (overrideExists)
			{
				foreach (var dic in dicn)
				{
					foreach (var key in dic.Keys)
					{
						main[key] = dic[key];
					}
				}
			}
			else
			{
				foreach (var dic in dicn)
				{
					foreach (var key in dic.Keys)
					{
						main.Add(key, dic[key]);
					}
				}
			}
		}

	}
}
